package each_class;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.Map.Entry;




//2021.6.20 3:00修改： 新增了一个可以直接获取歌手字符串的方法
public class SongClass {

	private String song_id; // 歌曲id
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((song_id == null) ? 0 : song_id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SongClass other = (SongClass) obj;
		if (song_id == null) {
			if (other.song_id != null)
				return false;
		} else if (!song_id.equals(other.song_id))
			return false;
		return true;
	}

	private String song_name;// 歌曲name
	private Map<String, String> singers; // 歌手
	private String album_id;// 专辑id
	private String album_name;// 专辑name
	private String song_time; // 时长
	private String song_image_url; // 歌曲图像
	private Map<String, String> lyric; // 歌词
	
	private String cachingpath; //缓存路径
	private String dowpath;  //下载路径
	
	private boolean	isFavorite; //最喜欢的
	private boolean	isDownload;	//下载
	
	


	public String getCachingpath() {
		return cachingpath;
	}

	public void setCachingpath(String cachingpath) {
		this.cachingpath = cachingpath;
	}

	public boolean isFavorite() {
		return isFavorite;
	}

	public void setFavorite(boolean isFavorite) {
		this.isFavorite = isFavorite;
	}

	public boolean isDownload() {
		return isDownload;
	}

	public void setDownload(boolean isDownload) {
		this.isDownload = isDownload;
	}

	

	public String getDowpath() {
		return dowpath;
	}

	public void setDowpath(String dowpath) {

		this.dowpath = dowpath;
	}

	public String getSong_id() {
		return song_id;
	}

	public void setSong_id(String song_id) {
		this.song_id = song_id;
	}

	public String getSong_name() {
		return song_name;
	}

	public void setSong_name(String song_name) {
		this.song_name = song_name;
	}

	public Map<String, String> getSingers() {
		return singers;
	}

	public void setSingers(Map<String, String> singers) {
		this.singers = singers;
	}

	public String getAlbum_id() {
		return album_id;
	}

	public void setAlbum_id(String album_id) {
		this.album_id = album_id;
	}

	public String getAlbum_name() {
		return album_name;
	}

	public void setAlbum_name(String album_name) {
		this.album_name = album_name;
	}

	public String getSong_time() {
		return song_time;
	}

	public void setSong_time(String song_time) {
		this.song_time = song_time;
	}

	public String getSong_image_url() {
		return song_image_url;
	}

	public void setSong_image_url(String song_image_url) {
		this.song_image_url = song_image_url;
	}

	

	public Map<String, String> getLyric() {
		return lyric;
	}

	public void setLyric(Map<String, String> lyric) {
		this.lyric = lyric;
	}

	
	@Override
	public String toString() {
		return "SongClass [song_id=" + song_id + ", song_name=" + song_name + ", singers=" + singers + ", album_id="
				+ album_id + ", album_name=" + album_name + ", song_time=" + song_time + ", song_image_url="
				+ song_image_url + ", lyric=" + lyric + ", cachingpath=" + cachingpath + ", dowpath=" + dowpath
				+ ", isFavorite=" + isFavorite + ", isDownload=" + isDownload + "]";
	}

	//获取时间分秒字符串
	public String getDuration() {
		if(song_time != null) {
		return new SimpleDateFormat("mm:ss").format(new Date(Long.parseLong(song_time)));	
		}
		return null;
	}
	//获取歌手的字符串
	public String getSingerString() {
		StringBuilder stringBuilder = new StringBuilder();
		if(singers != null) {
				for (Entry<String, String> entry : singers.entrySet()) {
			stringBuilder.append(entry.getValue()).append(' ');
		}
		}
	
		return stringBuilder.toString();
	}
	
	//获取歌手的字符串
		public String getSingerid() {
			StringBuilder stringBuilder = new StringBuilder();
			if(singers != null) {
					for (Entry<String, String> entry : singers.entrySet()) {
				stringBuilder.append(entry.getKey()).append(' ');
			}
			}
			return stringBuilder.toString();
		}
	
}
